<template>
  <div class="navbar">
    <div class="backbtn btn" @click="back">返回</div>
    <div class="title">{{ title }}</div>
    <div class="rbtn btn" @click="clickBtn" v-show="rbtn">{{ rbtn }}</div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "我的订单",
    },
    rbtn: {
      type: String,
    },
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    // 父元素点击事件
    clickBtn() {
      this.$emit("clickBtn", 123);
    },
  },
};
</script>

<style lang="scss" scoped>
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 1.173333rem;
  text-align: center;
  background-color: #292a2e;
  .title {
    font-size: 0.4rem;
    color: #fff;
    line-height: 1.173333rem;
  }
  .backbtn {
    position: absolute;
    left: 0.4rem;
    top: 0.2rem;
  }

  .rbtn {
    position: absolute;
    right: 0.4rem;
    top: 0.2rem;
  }
  .btn {
    color: #ccc;
    border: 1px solid #18181c;
    padding: 0.2rem 0.3rem;
    border-radius: 0.1rem;
    background-color: #24242a;
  }
}
</style>